/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * Sistema de Control Acádemico (saca) creado por Buñay Paulo
 */
@Entity
@Table(name = "DETALLE_DOCENTE_ANIO_LECTIVO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetalleDocenteAnioLectivo.findAll", query = "SELECT d FROM DetalleDocenteAnioLectivo d"),
    @NamedQuery(name = "DetalleDocenteAnioLectivo.findByIdDetalleDocenteAnioLectivo", query = "SELECT d FROM DetalleDocenteAnioLectivo d WHERE d.idDetalleDocenteAnioLectivo = :idDetalleDocenteAnioLectivo")})
public class DetalleDocenteAnioLectivo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_DETALLE_DOCENTE_ANIO_LECTIVO")
    private Integer idDetalleDocenteAnioLectivo;
    @JoinColumn(name = "ID_ANIO_LECTIVO", referencedColumnName = "ID_ANIO_LECTIVO")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private AnioLectivo anioLectivo;
    @JoinColumn(name = "ID_DOCENTE", referencedColumnName = "ID_DOCENTE")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Docente docente;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "detalleDocenteAnioLectivo", fetch = FetchType.LAZY)
    private List<DetalleDocenteAnioLectivoMateria> detalleDocenteAnioLectivoMateriaList;

    public DetalleDocenteAnioLectivo() {
    }

    public DetalleDocenteAnioLectivo(Integer idDetalleDocenteAnioLectivo) {
        this.idDetalleDocenteAnioLectivo = idDetalleDocenteAnioLectivo;
    }

    public Integer getIdDetalleDocenteAnioLectivo() {
        return idDetalleDocenteAnioLectivo;
    }

    public void setIdDetalleDocenteAnioLectivo(Integer idDetalleDocenteAnioLectivo) {
        this.idDetalleDocenteAnioLectivo = idDetalleDocenteAnioLectivo;
    }

    public AnioLectivo getAnioLectivo() {
        return anioLectivo;
    }

    public void setAnioLectivo(AnioLectivo anioLectivo) {
        this.anioLectivo = anioLectivo;
    }

    public Docente getDocente() {
        return docente;
    }

    public void setDocente(Docente docente) {
        this.docente = docente;
    }

    @XmlTransient
    public List<DetalleDocenteAnioLectivoMateria> getDetalleDocenteAnioLectivoMateriaList() {
        return detalleDocenteAnioLectivoMateriaList;
    }

    public void setDetalleDocenteAnioLectivoMateriaList(List<DetalleDocenteAnioLectivoMateria> detalleDocenteAnioLectivoMateriaList) {
        this.detalleDocenteAnioLectivoMateriaList = detalleDocenteAnioLectivoMateriaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetalleDocenteAnioLectivo != null ? idDetalleDocenteAnioLectivo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleDocenteAnioLectivo)) {
            return false;
        }
        DetalleDocenteAnioLectivo other = (DetalleDocenteAnioLectivo) object;
        if ((this.idDetalleDocenteAnioLectivo == null && other.idDetalleDocenteAnioLectivo != null) || (this.idDetalleDocenteAnioLectivo != null && !this.idDetalleDocenteAnioLectivo.equals(other.idDetalleDocenteAnioLectivo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "be.DetalleDocenteAnioLectivo[ idDetalleDocenteAnioLectivo=" + idDetalleDocenteAnioLectivo + " ]";
    }

}
